const Mock = require('mockjs')
//1-1
const data1 = Mock.mock({
    "alltotal|100000-1000000": 1,
    "daytotal|10000-20000": 1,
    "up|1-20": 1,
    "down|1-20": 1,
    "visitnum|1000-2000": 1,
    "transition|1000-2000": 1,

})
//1-2
const {
    data
} = Mock.mock({
    'data|3': [{
        value: '@shuffle(["45", "49", "55", "61", "73"])',
        name: '@title(1)'
    }]
})
//1-3
const
    datacircle = Mock.mock({
        'data|5': [{
            'value|100-350': 120,
            name: '@title(1)'
        }]
    })
// console.log(datacircle);
//1-4
const {
    datatree
} = Mock.mock({
    'datatree|3': [{
        data: '@shuffle([30, 52, 200, 334, 390, 330, 220])',
    }]
})
//2-1
const {
    dataline1
} = Mock.mock({
    'dataline1|2': [{
        data: '@shuffle([30, 120, 161, 134, 105, 160, 165, 100, 120, 161, 134, 105, 160, 165])',
    }]
})
// console.log(dataline1);
const {
    dataline2
} = Mock.mock({
    'dataline2|2': [{
        data: '@shuffle([100, 120, 161, 134, 105, 160, 165])',
    }]
})
//3-1
// const {
//     tableData
// } = Mock.mock({
//     'tableData|20-80': [{
//         'date|100-1000': 100,
//         address: Mock.mock('@cword(2,5)'),
//         'name|1-100': 1
//     }]

// })
//3-2
const tabley = [{
        value: 335,
        name: '直达',
        selected: true
    },
    {
        value: 1548,
        name: '搜索引擎'
    },
    {
        value: 679,
        name: '营销广告'
    }
]
const tabley2 = [

    {
        value: 1048,
        name: '直达'
    },
    {
        value: 310,
        name: '邮件营销'
    },
    {
        value: 234,
        name: '联盟广告'
    },
    {
        value: 1048,
        name: '百度'
    },
    {
        value: 251,
        name: '谷歌'
    },
    {
        value: 147,
        name: '必应'
    },
    {
        value: 102,
        name: '其他'
    },
    {
        value: 135,
        name: '视频广告'
    },
]
//2-2
const cardR = Mock.mock({
    'cardR|8': [{
        name: Mock.mock('@cword(2,5)'),
        'number|+1': 1,
        'allnum|100000-400000': 1
    }]
})
//------------------------------------------------
module.exports = [{
        url: '/dashboard/first/two',
        type: 'get',
        response: config => {
            return {
                data: data
            }
        }
    },
    {
        url: '/dashboard/first/one',
        type: 'get',
        response: config => {
            return {
                numdata: data1
            }
        }
    },
    {
        url: '/dashboard/first/three',
        type: 'get',
        response: config => {
            return {
                datacircle: datacircle
            }
        }
    },
    {
        url: '/dashboard/first/four',
        type: 'get',
        response: config => {
            return {
                datatree: datatree
            }
        }
    },
    {
        url: '/dashboard/second/one1',
        type: 'get',
        response: config => {
            return {
                dataline1: dataline1
            }
        }
    },
    {
        url: '/dashboard/second/one2',
        type: 'get',
        response: config => {
            return {
                dataline2: dataline2
            }
        }
    },
    {
        url: '/dashboard/third/one',
        type: 'get',
        response: config => {
            const {
                page = 1, pagesize = 10
            } = config.query;
            return {
                total: 23,
                tableData: Mock.mock({
                    ['tableData|' + pagesize]: [{
                        'date|100-1000': 100,
                        address: Mock.mock('@cword(2,5)'),
                        'name|0.0-2': 0
                    }]

                })
            }
        }
    },
    {
        url: '/dashboard/third/two1',
        type: 'get',
        response: config => {
            return {
                tabley: tabley
            }
        }
    },
    {
        url: '/dashboard/third/two2',
        type: 'get',
        response: config => {
            return {
                tabley2: tabley2
            }
        }
    },
    {
        url: '/dashboard/two/two',
        type: 'get',
        response: config => {
            return {
                cardR: cardR
            }
        }
    },
]